import BaseApi from "@/api/BaseApi.ts";
import type IPageResp from "@/type/IPageResp.ts";
import type ISysSchedulerTaskReq from "../type/req/ISysSchedulerTaskReq.ts";
import type ISysSchedulerTaskResp from "../type/resp/ISysSchedulerTaskResp.ts";

class SysSchedulerTaskApi extends BaseApi {

    constructor() {
        super("/api/schedulerTask")
    }

    /**
     * 分页查询
     */
    page = (sysSchedulerTaskReq: ISysSchedulerTaskReq) => {
        return this.get<IPageResp<ISysSchedulerTaskResp>, ISysSchedulerTaskReq>('page', sysSchedulerTaskReq)
    }

    /**
     * 根据id查询数据
     */
    queryById = (id: String) => {
        return this.get('queryById', {id})
    }

    /**
     * 根据有无id新增或编辑数据
     */
    addOrUpdate = (sysSchedulerTaskReq: ISysSchedulerTaskReq) => {
        return this.post<string, ISysSchedulerTaskReq>('addOrUpdate', sysSchedulerTaskReq)
    }

    /**
     * 根据id删除数据
     */
    deleteById = (ids: string[]) => {
        return this.delete<string>('delete', ids)
    }

}

export default new SysSchedulerTaskApi()